package com.design.pattern.delegate;

import java.util.HashMap;
import java.util.Map;

/**
 * create by yufeng on 2021/7/5 14:15
 */
public class LeaderDelegate implements IEmployee{
    Map<String, IEmployee> map = new HashMap<String, IEmployee>();

    public LeaderDelegate() {
        map.put("java", new EmployeeA());
        map.put("C++", new EmployeeB());
        map.put("web", new EmployeeC());
    }
    public void coding(String task) {
        if (!map.containsKey(task)) {
            System.out.println("这个任务" + task + "超出了我的能力范围");
            return;
        }
        map.get(task).coding(task);

    }
}
